package m.common.action;

import m.appserver.ServerResult;
import m.appserver.ServerResultStatus;

public abstract class HtmlResult implements ServerResult {
    public abstract String outHtml();

    @Override
    public String toString() {
        return outHtml();
    }

    private ServerResultStatus status=ServerResultStatus.SUCCESS;

    public void setStatus(ServerResultStatus status) {
        this.status = status;
    }
    @Override
    public ServerResultStatus getStatus() {
        return this.status;
    }
    public static HtmlResult toErrorPage(String error){
        HtmlPageResult page=new HtmlPageResult("page/error.html");
        page.setStatus(ServerResultStatus.ERROR);
        return page.addParam("error", error);
    }
    @Override
    public String getContent() {
        return "HtmlResult页面";
    }
}
